
//
//  LoginUtils.m
//  CustomProject
//
//  Created by 方涛 on 2017/5/22.
//  Copyright © 2017年 puyue.com. All rights reserved.
//

#import "LoginUtils.h"

@implementation LoginUtils
//登录 userLoginSX.do
-(void)loginSucceed:(RequestSuccess)sc failure:(RequestFail)fai
{
    NSMutableDictionary *dic=[NSMutableDictionary new];
    NSMutableDictionary *Truck=[self getTruckParameter];
    NSMutableDictionary *post=[NSMutableDictionary new];
    NSMutableDictionary *Body=[NSMutableDictionary new];
    [Body setValue:self.cell forKey:@"user_mobile"];
    [Body setValue:self.checkCode forKey:@"sms_code"];
    [Body setValue:[MyControl getObjectForKey:K_UUID] forKey:@"randnum"];
    [Truck setObject:Body forKey:@"Body"];
    [dic setObject:Truck  forKey:@"Truck"];
    [post setObject:[self convertToJsonData:dic] forKey:@"Truck"];
    
    [BaseHttp postRequestUrl:[NSString stringWithFormat:@"%@%@",REQ_BASE_URL,@"api/user/login"] params:post cache:NO
                      target:nil indicator:NO progressBlock:^(NSProgress *progress) {
                          
                      } successBlock:^(id response) {
                          sc(response);
                      } failBlock:^(NSError *error) {
                          [SVProgressHUD dismiss];
                          
                          fai(nil);
                      }];
}

//校验验证码
-(void)registerVerifyCodeSucceed:(RequestSuccess)sc failure:(RequestFail)fai{

}
/**
 注册账号
 loginPwdSet.do
 */
-(void)loginPwdSet1Succeed:(RequestSuccess)sc failure:(RequestFail)fai{

}
/**
 绑定新手机
*/
-(void)bangdingxinshouji:(RequestSuccess)sc failure:(RequestFail)fai
{

}
/**
 验证码
 */
-(void)sendVerifyCodeSucceed:(RequestSuccess)sc failure:(RequestFail)fai{
    
    NSMutableDictionary *dic=[NSMutableDictionary new];
    NSMutableDictionary *Truck=[self getTruckParameter];
    NSMutableDictionary *post=[NSMutableDictionary new];
    NSMutableDictionary *Body=[NSMutableDictionary new];
    [Body setValue:self.cell forKey:@"user_mobile"];
    [Truck setObject:Body forKey:@"Body"];
    [dic setObject:Truck  forKey:@"Truck"];
    [post setObject:[self convertToJsonData:dic] forKey:@"Truck"];

    [BaseHttp postRequestUrl:[NSString stringWithFormat:@"%@%@",REQ_BASE_URL,@"api/user/registe"] params:post cache:NO
                      target:nil indicator:NO progressBlock:^(NSProgress *progress) {
                          
                      } successBlock:^(id response) {
                          sc(response);
                      } failBlock:^(NSError *error) {
                          [SVProgressHUD dismiss];
                          
                          fai(nil);
                      }];
    
}
/**
 发送验证码
 */
-(void)sendCodeSucceed:(RequestSuccess)sc failure:(RequestFail)fai{
    
    NSMutableDictionary *dic=[NSMutableDictionary new];
    NSMutableDictionary *Truck=[self getTruckParameter];
    NSMutableDictionary *post=[NSMutableDictionary new];
    NSMutableDictionary *Body=[NSMutableDictionary new];
    if (self.cell.length>0)
    {
        [Body setValue:self.cell forKey:@"user_mobile"];
    }
    [Body setObject:[MyControl getObjectForKey:K_USERID] forKey:@"user_id"];
    [Truck setObject:Body forKey:@"Body"];
    [dic setObject:Truck  forKey:@"Truck"];
    
    [post setObject:[self convertToJsonData:dic] forKey:@"Truck"];
    
    [BaseHttp postRequestUrl:[NSString stringWithFormat:@"%@%@",REQ_BASE_URL,@"api/phone/send_sms"] params:post cache:NO
                      target:nil indicator:NO progressBlock:^(NSProgress *progress) {
                          
                      } successBlock:^(id response) {
                          sc(response);
                      } failBlock:^(NSError *error) {
                          [SVProgressHUD dismiss];
                          
                          fai(nil);
                      }];
    
}
/**
 验证验证码
 */
-(void)VerifyCodeSucceed:(RequestSuccess)sc failure:(RequestFail)fai{
    
    NSMutableDictionary *dic=[NSMutableDictionary new];
    NSMutableDictionary *Truck=[self getTruckParameter];
    NSMutableDictionary *post=[NSMutableDictionary new];
    NSMutableDictionary *Body=[NSMutableDictionary new];
    if (self.cell.length>0)
    {
        [Body setValue:self.cell forKey:@"user_mobile"];
    }
    [Body setObject:[MyControl getObjectForKey:K_USERID] forKey:@"user_id"];
    [Body setObject:self.checkCode forKey:@"sms_code"];
    
    
    [Truck setObject:Body forKey:@"Body"];
    [dic setObject:Truck  forKey:@"Truck"];
    
    [post setObject:[self convertToJsonData:dic] forKey:@"Truck"];
    
    [BaseHttp postRequestUrl:[NSString stringWithFormat:@"%@%@",REQ_BASE_URL,@"api/phone/change_phone"] params:post cache:NO
                      target:nil indicator:NO progressBlock:^(NSProgress *progress) {
                          
                      } successBlock:^(id response) {
                          sc(response);
                      } failBlock:^(NSError *error) {
                          [SVProgressHUD dismiss];
                          
                          fai(nil);
                      }];
}
/**
 modifyUserLoginPwd.do 修改登录密码 reqType=2
 */
-(void)loginPwdSet2Succeed:(RequestSuccess)sc failure:(RequestFail)fai{

    
}
/**
 loginPwdSet.do 忘记密码修改登录密码 reqType=3
 */
-(void)loginPwdSet3Succeed:(RequestSuccess)sc failure:(RequestFail)fai{

    
}

/**
 modifyUserPwd.do  支付密码设置  修改
 */
-(void)payPwdSetSucceed:(RequestSuccess)sc failure:(RequestFail)fai
{
}
/**
 forgetPayPwd.do  忘记支付密码
 */
-(void)forgetPayPwdSucceed:(RequestSuccess)sc failure:(RequestFail)fai
{
 
}
@end
